package Action;

import org.hibernate.Session;
import org.hibernate.Transaction;

import hibconfig.HibernateSessionFactory;
import entity.Student;

public class AddStudent {
	private String stuid;
	private String stupwd;
	public String getStuid() {
		return stuid;
	}
	public void setStuid(String stuid) {
		this.stuid = stuid;
	}
	public String getStupwd() {
		return stupwd;
	}
	public void setStupwd(String stupwd) {
		this.stupwd = stupwd;
	}
	public String execute(){
		  Session session=HibernateSessionFactory.getSession();
		  Student s=new Student(stuid,stupwd);
	      Transaction tran=session.beginTransaction();
	      session.save(s);
	      tran.commit();
	      session.close();
		return "success";
	}
}
